package common.changedtracker;


import java.util.HashMap;
import java.util.Map;

public class ChangeMarker {
    private static final ThreadLocal<Map<Object,Boolean>> CURRENT = new ThreadLocal<>();
	
    private static Map<Object,Boolean> getCurrentMap(){
		Map<Object,Boolean> result=CURRENT.get();
		if(result==null){
			result=new HashMap<>(16);
			CURRENT.set(result);
		}
		return result;
	}
	public static void setNoChanged(Object object){
		getCurrentMap().put(object, false);
	}
	public static void setChanged(Object object){
		getCurrentMap().put(object, true);
	}
	public static boolean isChanged(Object object){
		Boolean result=getCurrentMap().get(object);
		return result==null?false:result;
	}

}
